import Vue from 'vue'
import Vuex from 'vuex'
import {getMenuByRouter} from "@/libs/util";
import routers from '@/router/routers'
import vue from '@/main'
import formCreate from './module/form/form-create'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    userInfo: null,
    menus:[{name:'客服',path:'/service',pos:23},
      {name:'工单',path:'/ticket',pos:4},
      {name:'员工',path:'/people',pos:12},
      {name:'知识库',path:'/knowledge',pos:31},
      {name:'联系人',path:'/customer',pos:46},
      {name:'设置',path:'/setting',pos:20}],
    menuList:{},
    imConnectionState:-1
  },
  mutations: {
    updateUserInfo(state,user){
      state.userInfo = user
    },
    updateMenuList(state,list){
      if(list!=null) {
        state.menuList = list
      }
    },
    updateImConnectionState(state,s) {
      state.imConnectionState = s
    }
  },
  getters: {
  },
  actions: {
    //
  },
  modules: {
    formCreate
  }
})
